export Video
Exports a design block as a video file of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Return
the exported video. From Android 9 a buffer of 1 MiB or more is a direct buffer over a temp file of the engine, without a copy and without a backing array: read it with get, not array. The file goes once the buffer and every view of it are collected.
Parameters
the page or the scene to export. A scene plays its pages one after the other, in the order of SceneApi.getPages, each for its own duration. A page with a duration of zero does not appear. A hidden page does not appear either. The pages must have the same size, otherwise the export fails.
the time offset in seconds of the page's timeline from which the video will start. For a scene, the timeline of all its pages, which BlockApi.getDuration of the scene measures.
the duration in seconds of the final video. timeOffset and duration replace ExportVideoOptions.timeOffset and ExportVideoOptions.duration.
the mime type of the output video file.
a callback that reports on the progress of the export. It informs the receiver of the number of frames rendered by the engine, the number of encoded frames, and the total number of frames to encode.
the options used for the export of the block.
the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.
optional async resolution function that accepts both relative and absolute uri and returns an absolute uri. A buffer:// uri that it returns must name a buffer that the exported scene uses, because the background engine holds no other.
Exports multiple design blocks as video files of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Videos are exported sequentially, with progress reported for each video. This method is more memory efficient than calling exportVideo repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Return
the exported video data for each block, in the same order as the input blocks. From Android 9 a buffer of 1 MiB or more is a direct buffer over a temp file of the engine, without a copy and without a backing array: read it with get, not array. The file goes once the buffer and every view of it are collected.
Parameters
the pages or the scenes to export. A scene plays its pages one after the other, in the order of SceneApi.getPages, each for its own duration. A page with a duration of zero does not appear. A hidden page does not appear either. The pages must have the same size, otherwise the export fails.
the time offset in seconds of each page's timeline from which the video will start. For a scene, the timeline of all its pages, which BlockApi.getDuration of the scene measures.
the duration in seconds of each final video. timeOffset and duration replace ExportVideoOptions.timeOffset and ExportVideoOptions.duration.
the mime type of the output video files.
a callback that reports on the progress of each export. It informs the receiver of the number of frames rendered by the engine, the number of encoded frames, and the total number of frames to encode.
the options used for the export of each block.
the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.
optional async resolution function that accepts both relative and absolute uri and returns an absolute uri. A buffer:// uri that it returns must name a buffer that the exported scene uses, because the background engine holds no other.
Exports a design block as a video file of the given mime type. Note: MP4 exports embed a PNG cover at the page cover time when playback/coverTimeEnabled is true, else at the page playback position. coverTimeOffset overrides both. An MP4 export of a scene uses its first frame as the cover. Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance. Use it only until the suspending function resumes. Use this lambda to configure the background engine for export. It holds only the buffers that the exported scene uses, so create any other buffer on it here. A later export of a scene without video or audio can reuse that engine with the resources it loaded, so onPreExport runs on every export, and what it changes stays for the next export: settings, role, global scopes, asset sources and event subscriptions. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).
Return
the exported video. From Android 9 a buffer of 1 MiB or more is a direct buffer over a temp file of the engine, without a copy and without a backing array: read it with get, not array. The file goes once the buffer and every view of it are collected.
Parameters
the page or the scene to export. A scene plays its pages one after the other, in the order of SceneApi.getPages, each for its own duration. A page with a duration of zero does not appear. A hidden page does not appear either. The pages must have the same size, otherwise the export fails.
the mime type of the output video file: MimeType.MP4 or MimeType.WEBM.
the options used for the export of the block, including ExportVideoOptions.timeOffset and ExportVideoOptions.duration. Null exports the whole page or scene with the default options.
optional callback that reports on the progress of the export. It informs the receiver of the number of frames rendered by the engine, the number of encoded frames, and the total number of frames to encode.
the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.
optional async resolution function that accepts both relative and absolute uri and returns an absolute uri. A buffer:// uri that it returns must name a buffer that the exported scene uses, because the background engine holds no other.
Exports multiple design blocks as video files of the given mime type, one after the other, with one background engine. Otherwise it works like the exportVideo overload for one block.
Return
the exported video data for each block, in the same order as the input blocks.
Parameters
the pages or the scenes to export. A scene plays its pages one after the other, in the order of SceneApi.getPages, each for its own duration. A page with a duration of zero does not appear. A hidden page does not appear either. The pages must have the same size, otherwise the export fails.
the mime type of the output video files: MimeType.MP4 or MimeType.WEBM.
the options used for the export of each block. A null ExportVideoOptions.duration exports the whole duration of each page or scene.
optional callback that reports on the progress of each export.
the lambda to configure the background engine before export.
optional async resolution function that accepts both relative and absolute uri and returns an absolute uri.